clc;
close all;

%creation de l'image A
A = zeros(30);
A(:,6:13)=1;
A(:,18:25)=1;
A=double(A);

%creation de l'image B
B = double(zeros(30));
B(6:13,:)=1;
B(18:25,:)=1;
B=double(B);

%creation de la transformation de fourier et centrage de celle-ci
A_ft = fftshift(fft2(A));
B_ft = fftshift(fft2(B));

%module
A_mod = abs(A_ft);
B_mod = abs(B_ft);

%angle
A_ang = angle(A_ft);
B_ang = angle(B_ft);

subplot(3,2,1);
imshow(A,'InitialMagnification','fit');
title('A');

subplot(3,2,2);
imshow(B,'InitialMagnification','fit');
title('B');

subplot(3,2,3);
imshow(A_mod,'InitialMagnification','fit');
title('Module de A');

subplot(3,2,4);
imshow(B_mod,'InitialMagnification','fit');
title('Module de B');

subplot(3,2,5);
imshow(A_ang,'InitialMagnification','fit');
title('Phase de A');

subplot(3,2,6);
imshow(B_ang,'InitialMagnification','fit');
title('Phase de B');
